<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>

fn1().then(fn2).then(fn3).then(console.log);


function fn1(str){
    var a='hello';
   return new Promise((resolve,reject)=>{
      setTimeout(()=>{
          console.log('f1','');
         resolve(a)
      },1000)
   })
}

function fn2(str){
    var b='lagou'; 
   return new Promise((resolve,reject)=>{
      setTimeout(()=>{
         console.log('fn2...')
         resolve(str+b)
      },1000)
   })
}

function fn3(str){
    var c='i love u'; 
   return new Promise((resolve,reject)=>{
      setTimeout(()=>{
        resolve(str+c)
      },10)
   })
}

function onerror(){
   console.log('error')
}

let a= {name:'hello'}



// async function exec(){
//     let a = await pro('hello');
//     let b = await pro('lagou');
//     let c = await pro('i love u');
//     const result= a+b+c
//     console.log(result); 
// }

//exec()

// function sum (arr){
//   return arr.length && arr.reduce((prev, cur)=>{
// return prev + cur;
// })
// };



    </script>
</body>
</html>